<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="持卡人姓名">
              <a-input placeholder="请输入持卡人姓名" v-model="queryParam.bankName"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="持卡人卡号">
              <a-input placeholder="请输入持卡人卡号" v-model="queryParam.bankNumber"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="用户id">
              <a-input placeholder="请输入用户id" v-model="queryParam.userhomeId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="用户邮箱">
              <a-input placeholder="用户邮箱" v-model="queryParam.username"></a-input>
            </a-form-item>
          </a-col>

          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button type="primary" icon="download" @click="handleExportXls('实名认证')">导出</a-button>
      <!-- 高级查询区域 -->
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span slot="status" slot-scope="text, record, index">
            <a-tag color="pink" v-if="text==0">待审核</a-tag>
            <a-tag color="#87d068" v-if="text==1" >通过</a-tag>
            <a-tag color="#e70a0a" v-if="text==2" >未通过</a-tag>
        </span>

<!--
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>-->

      </a-table>
    </div>


  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'


  export default {
    name: 'YcUserhomeBankList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {

    },
    data () {
      return {
        description: '用户银行卡管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'用户id',
            align:"center",
            dataIndex: 'userhomeId'
          },
          {
            title:'用户邮箱',
            align:"center",
            dataIndex: 'username'
          },
          {
            title:'持卡人姓名',
            align:"center",
            dataIndex: 'accountName'
          },
          {
            title:'银行名称',
            align:"center",
            dataIndex: 'bankName'
          },
          {
            title:'银行卡号',
            align:"center",
            dataIndex: 'bankNumber'
          },
        {
          title:'银行卡正面',
          align:"center",
          dataIndex: 'bankBeforeUrl',
          scopedSlots: { customRender: 'imgSlot' }
        },
        {
          title:'银行卡反面',
          align:"center",
          dataIndex: 'bankAfterUrl',
          scopedSlots: { customRender: 'imgSlot' }
        },
          {
            title:'申请时间',
            align:"center",
            dataIndex: 'createtime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'处理时间',
            align:"center",
            dataIndex: 'verifytime',
            customRender:function (text) {
              return !text?"":(text.length>10?text.substr(0,10):text)
            }
          },
          {
            title:'状态',
            align:"center",
            dataIndex: 'status',
            scopedSlots: { customRender: 'status' }
          }
       /*   {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }*/
        ],
        url: {
          list: "/bank/ycUserhomeBank/list",
          delete: "/bank/ycUserhomeBank/delete",
          deleteBatch: "/bank/ycUserhomeBank/deleteBatch",
          exportXlsUrl: "/bank/ycUserhomeBank/exportXls",
          importExcelUrl: "bank/ycUserhomeBank/importExcel",

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'int',value:'userhomeId',text:'平台用户id',dictCode:''})
        fieldList.push({type:'int',value:'type',text:'0 银行卡 1支付宝 2微信 ',dictCode:''})
        fieldList.push({type:'string',value:'accountName',text:'账号姓名',dictCode:''})
        fieldList.push({type:'string',value:'bankName',text:'银行名称',dictCode:''})
        fieldList.push({type:'string',value:'bankNumber',text:'银行卡号',dictCode:''})
        fieldList.push({type:'int',value:'status',text:'0未审核 1通过 2拒绝',dictCode:''})
        fieldList.push({type:'date',value:'createtime',text:'创建时间'})
        fieldList.push({type:'int',value:'bankTypeId',text:'银行卡类型id',dictCode:''})
        fieldList.push({type:'date',value:'verifytime',text:'审核时间'})
        fieldList.push({type:'string',value:'phone',text:'银行预留电话',dictCode:''})
        fieldList.push({type:'int',value:'yingshengbankid',text:'对应银盛银行id yc_yingsheng_bank表的id',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>